<html>
<head>
<#include "/common/common2.ftl"/>
</head>
<body>
	<div id="rrapp" v-cloak>
		<div v-show="showList">
			<div class="m-b-md" style="display: none;">
				<form class="form-inline" role="form" id="searchForm" name="searchForm">
					<div class="form-group"></div>
					<a href="javascript:void(0)" class="btn btn-s-md btn-default btn-rounded" id="search">查询</a>
				</form>
			</div>
			<header class="panel-heading">
				<div class="doc-buttons">
					<a class="btn btn-primary" @click="add">
						<i class="fa fa-plus"></i>
						&nbsp;新增
					</a>
					<a class="btn btn-primary" @click="update">
						<i class="fa fa-pencil-square-o"></i>
						&nbsp;修改
					</a>
					<a class="btn btn-primary" @click="del">
						<i class="fa fa-trash-o"></i>
						&nbsp;删除
					</a>
					<a class="btn btn-primary" @click="save">
						<i class="fa fa-refresh"></i>
						&nbsp;生成菜单
					</a>
					<a class="btn btn-primary" @click="cleanmenu">
						<i class="fa fa-trash-o"></i>
						&nbsp;清空远程菜单
					</a>
				</div>
			</header>
			<div style="background-color: #ecf0f5;">
				<table id="menuTable" data-mobile-responsive="true" data-click-to-select="true">
					<tr>
						<th data-field="selectItem" data-checkbox="true"></th>
					</tr>
				</table>
			</div>
		</div>
		<div v-show="!showList" class="panel panel-default">
			<div class="panel-heading">{{title}}</div>
			<form class="form-horizontal">
				<div class="form-group">
					<div class="col-sm-2 control-label">名称</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="weixinmenu.name" placeholder="" required="required" />
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.id ==null">
					<div class="col-sm-2 control-label">类型</div>
					<div class="col-sm-10">
						<select class="form-control" v-model="weixinmenu.ifsub">
							<option value="2">菜单</option>
							<option value="1">按钮</option>
						</select>
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.ifsub ==2">
					<div class="col-sm-2 control-label">菜单序号</div>
					<div class="col-sm-10">
						<select class="form-control" v-model="weixinmenu.menuorder">
							<option value="1">1</option>
							<option value="2">2</option>
							<option value="3">3</option>
						</select>
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.ifsub ==1">
					<div class="col-sm-2 control-label">按钮序号</div>
					<div class="col-sm-10">
						<select class="form-control" v-model="weixinmenu.buttonorder">
							<option value="1">1</option>
							<option value="2">2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5</option>
						</select>
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.ifsub ==1&& weixinmenu.id ==null">
					<div class="col-sm-2 control-label">上级菜单</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" style="cursor: pointer;" v-model="weixinmenu.parentname" @click="menuTree" readonly="readonly" placeholder="一级菜单" />
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.ifsub ==1">
					<div class="col-sm-2 control-label">按钮类型</div>
					<div class="col-sm-10">
						<select class="form-control" v-model="weixinmenu.type">
							<option value="view">链接类型</option>
							<!--  <option value="click">点击类型</option>
							<option value="scancode_push">扫一扫</option>
							<option value="scancode_waitmsg">发送照片</option>
							<option value="pic_sysphoto">发送照片</option>
							<option value="pic_photo_or_album">发送照片</option>
							<option value="pic_weixin">发送照片</option>
							<option value="location_select">发送位置</option>
							<option value="media_id">下发消息</option>
							<option value="view_limited">图文消息</option>-->
						</select>
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.type =='click'&&weixinmenu.ifsub ==1">
					<div class="col-sm-2 control-label">按钮KEY值</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="weixinmenu.key" placeholder="" required="required" />
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.type =='view'&&weixinmenu.ifsub ==1">
					<div class="col-sm-2 control-label">按钮链接</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="weixinmenu.url" placeholder="" required="required" />
					</div>
				</div>
				<div class="form-group" v-if="(weixinmenu.type =='media_id'||weixinmenu.type =='view_limited')&&weixinmenu.ifsub ==1">
					<div class="col-sm-2 control-label">素材ID</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="weixinmenu.media_id" placeholder="" required="required" />
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.type =='miniprogram'&&weixinmenu.ifsub ==1">
					<div class="col-sm-2 control-label">小程序ID</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="weixinmenu.appid" placeholder="" />
					</div>
				</div>
				<div class="form-group" v-if="weixinmenu.type =='miniprogram'&&weixinmenu.ifsub ==1">
					<div class="col-sm-2 control-label">小程序路径</div>
					<div class="col-sm-10">
						<input type="text" class="form-control" v-model="weixinmenu.pagepath" placeholder="" required="required" />
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-2 control-label"></div>
					<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定" />
					&nbsp;&nbsp;
					<input type="button" class="btn btn-warning" @click="reload" value="返回" />
				</div>
			</form>
		</div>
	</div>
	<!-- 选择菜单 -->
	<div id="menuLayer" style="display: none; padding: 10px;">
		<ul id="menuTree" class="ztree"></ul>
	</div>
	<script type="text/javascript" src="/js/weixin/menu.js"></script>
</body></html>